package com.liu.voluntary.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class RespBean {

    private long code;
    private String message;
    private Object obj;


    //登录成功后 -- 携带数据返回
    public static RespBean success(Object data){

        return new RespBean(RespBeanEnum.SUCCESS.getCode(),RespBeanEnum.SUCCESS.getMessage(),data);
    }

    //登录成功后 -- 不携带数据返回
    public static RespBean success(){

        return new RespBean(RespBeanEnum.SUCCESS.getCode(),RespBeanEnum.SUCCESS.getMessage(),null);
    }

//    失败--携带数据返回
    public static RespBean error(RespBeanEnum respBeanEnum,Object data){

        return new RespBean(respBeanEnum.getCode(),respBeanEnum.getMessage(), data);
    }

    //    失败--不携带数据返回
    public static RespBean error(RespBeanEnum respBeanEnum){

        return new RespBean(respBeanEnum.getCode(),respBeanEnum.getMessage(), null);

    }




}






